// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package pica.core;

import java.io.*;
import java.util.Random;
import java.util.Vector;
import javax.microedition.io.*;
import pica.ui.h;

// Referenced classes of package pica.core:
//            a, b, c, d, 
//            e

public final class g
    implements Runnable
{

    public g(d d1)
    {
        h = new Vector();
        b = d1.a();
        g = new a(this);
        a = d1;
    }

    final void a(byte byte0)
    {
        b(byte0);
        e = new Thread(this);
        e.start();
    }

    final synchronized void a()
    {
        o = 0;
        p = e.a[o] * 1000;
    }

    private void b(byte byte0)
    {
        b.i = byte0;
        if(b.i == 0)
        {
            p = 10000;
            return;
        }
        if(b.i == 1)
        {
            p = 20000;
            return;
        }
        if(b.i == 2)
        {
            p = 60000;
            return;
        }
        if(b.i == 3)
        {
            o = 0;
            p = e.a[o] * 1000;
        }
    }

    final void a(boolean flag)
    {
        q = flag;
    }

    final boolean b()
    {
        return i != null;
    }

    final void a(String s1)
    {
        i = s1;
    }

    final void b(String s1)
    {
        j = s1;
        if(s1.equals("\u8FDE\u63A5\u4E2D\u65AD"))
            m = true;
    }

    private void b(boolean flag)
        throws Exception
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("jid=");
        stringbuffer.append(b.f());
        stringbuffer.append("&pass=");
        stringbuffer.append(b.b);
        stringbuffer.append("&version=");
        stringbuffer.append(b.c);
        stringbuffer.append("&source=");
        stringbuffer.append(b.d);
        if(flag)
        {
            f("login", "/login-sid.xml?" + stringbuffer.toString(), null);
            return;
        } else
        {
            h("login", "/login-sid.xml?" + stringbuffer.toString(), null);
            return;
        }
    }

    private void i()
    {
        synchronized(h)
        {
            h.insertElementAt(((Object) (new Object[] {
                "roster", "/raw.xml", "<iq id='roster' type='get'><query xmlns='jabber:iq:roster'></query></iq>"
            })), 0);
            h.insertElementAt(((Object) (new Object[] {
                "cache", "/cache.xml", null
            })), 1);
        }
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<iq type='get' to='pica'><query xmlns='jabber:iq:picazone'><lang>cn</lang><category>");
        stringbuffer.append("128K");
        stringbuffer.append("</category></query></iq>");
        stringbuffer.append("<iq type='get' to='pica'><query xmlns='jabber:iq:autoupdate'><source>");
        stringbuffer.append(b.d);
        stringbuffer.append("</source></query></iq>");
        stringbuffer.append("<iq type='get'><query xmlns='jabber:iq:blacklist'/></iq>");
        stringbuffer.append("<iq type='get' to='cluster.pica'><query xmlns='pica:cluster:category'/></iq>");
        stringbuffer.append("<iq type='get' to='cluster.pica'><query xmlns='pica:cluster:clusterlist'/></iq>");
        stringbuffer.append("<iq type='get' to='cluster.pica'><query xmlns='pica:cluster:roomlist'/></iq>");
        stringbuffer.append("<iq type='get' to='game.pica'><query xmlns='pica:game:roomlist'/></iq>");
        h("combo", "/raw.xml", stringbuffer.toString());
    }

    final void c(String s1)
    {
        String s2 = "<iq type='set'><query xmlns='jabber:iq:blacklist'><item jid='" + (s1.indexOf("@") <= 0 ? s1 + "@pica" : s1) + "' status='block'/></query></iq>";
        h("blacklist", "/raw.xml", s2.toString());
    }

    final void a(String s1, String s2, String s3)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<iq type='get' to='cluster.pica'><query xmlns='jabber:iq:newsearch'>");
        if(s1 != null && s1.length() > 0)
            stringbuffer.append("<CLUSTER>" + l(s1) + "</CLUSTER>");
        if(s2 != null && s2.length() > 0)
            stringbuffer.append("<CATEGORY>" + l(s2) + "</CATEGORY>");
        if(s3 != null && s3.length() > 0)
            stringbuffer.append("<NICKNAME>" + l(s3) + "</NICKNAME>");
        stringbuffer.append("</query></iq>");
        h("searchCluster", "/raw.xml", stringbuffer.toString());
    }

    final void d(String s1)
    {
        String s2 = "<iq type='set'><query xmlns='jabber:iq:blacklist'><item jid='" + (s1.indexOf("@") <= 0 ? s1 + "@" + "pica" : s1) + "' status='unblock'/></query></iq>";
        h("unblock", "/raw.xml", s2.toString());
    }

    final void c()
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<iq type='get' to='cluster.pica'><query xmlns='pica:cluster:roomlist'/></iq>");
        h("getChatroom", "/raw.xml", stringbuffer.toString());
    }

    final void d()
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<iq type='get' to='cluster.pica'><query xmlns='pica:cluster:clusterlist'/></iq>");
        h("getClusterRoomList", "/raw.xml", stringbuffer.toString());
    }

    final void e()
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<iq type='get' to='game.pica'><query xmlns='pica:game:roomlist'/></iq>");
        h("getGameRoomList", "/raw.xml", stringbuffer.toString());
    }

    final void e(String s1)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<presence type='available' to='");
        stringbuffer.append(s1);
        stringbuffer.append("'>");
        stringbuffer.append("<show>enter</show>");
        stringbuffer.append("<icon>" + b.y + "</icon>");
        stringbuffer.append("<v_stream>no</v_stream>");
        stringbuffer.append("<v_msg>no</v_msg>");
        stringbuffer.append("<unibrew>no</unibrew>");
        stringbuffer.append("<pc>yes</pc>");
        stringbuffer.append("<name>" + l(b.n) + "</name>");
        stringbuffer.append("</presence>");
        h("loginGameRoom", "/raw.xml", stringbuffer.toString());
    }

    final void a(String s1, String s2)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<presence type='unavailable' to='").append(s1).append("' roomid='").append(s2).append("'/>");
        h("logoutGameRoom", "/raw.xml", stringbuffer.toString());
    }

    final void b(String s1, String s2)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<presence type='available' to='" + s1 + "'>");
        stringbuffer.append("<show>enter</show>");
        stringbuffer.append("<icon>" + b.y + "</icon>");
        stringbuffer.append("<v_stream>no</v_stream>");
        stringbuffer.append("<v_msg>no</v_msg>");
        stringbuffer.append("<unibrew>no</unibrew>");
        stringbuffer.append("<history>0</history>");
        stringbuffer.append("<pc>yes</pc>");
        stringbuffer.append("<name>" + l(s2) + "</name>");
        stringbuffer.append("</presence>");
        h("chatroom", "/raw.xml", stringbuffer.toString());
    }

    final void c(String s1, String s2)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<presence type='available' to='");
        stringbuffer.append(s1);
        stringbuffer.append("'><show>" + l(s2) + "</show>");
        stringbuffer.append("<icon>" + b.y + "</icon>");
        stringbuffer.append("<v_stream>no</v_stream>");
        stringbuffer.append("<v_msg>no</v_msg>");
        stringbuffer.append("<unibrew>no</unibrew>");
        stringbuffer.append("<pc>yes</pc>");
        stringbuffer.append("<history>0</history>");
        stringbuffer.append("<name></name>");
        stringbuffer.append("</presence>");
        h("loginCluster", "/raw.xml", stringbuffer.toString());
    }

    final void f(String s1)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<presence type='unavailable' to='" + s1 + "'/>");
        h("outChatroom", "/raw.xml", stringbuffer.toString());
    }

    final void b(String s1, String s2, String s3)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<message to='" + l(s1) + "' type='" + l(s2) + "'><body>" + l(s3) + "</body></message>");
        h("message", "/raw.xml", stringbuffer.toString());
    }

    final void c(String s1, String s2, String s3)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<message").append(" to='").append(l(s1)).append("' type='").append(l(s2)).append("'");
        if(s1.indexOf("@game.pica") != -1)
            stringbuffer.append(" roomid='" + b.C + "'");
        stringbuffer.append("><body>");
        stringbuffer.append(l(s3));
        stringbuffer.append("</body></message>");
        h("message", "/raw.xml", stringbuffer.toString());
    }

    final void a(String s1, String s2, boolean flag, String s3, String s4, String s5)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<iq type='get' to='search.pica'><query xmlns='jabber:iq:newsearch'>");
        if(s1 != null)
            stringbuffer.append("<jid>" + l(s1) + "@" + "pica" + "</jid>");
        if(s2 != null)
            stringbuffer.append("<nick>" + l(s2) + "</nick>");
        if(flag)
            stringbuffer.append("<online/>");
        if(s3 != null)
            stringbuffer.append("<region>" + l(s3) + "</region>");
        if(s4 != null)
            stringbuffer.append("<age>" + l(s4) + "</age>");
        if(s5 != null)
            stringbuffer.append("<sex>" + l(s5) + "</sex>");
        stringbuffer.append("</query></iq>");
        h("search", "/raw.xml", stringbuffer.toString());
    }

    final void g(String s1)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<iq type='get' to='");
        stringbuffer.append(l(s1));
        stringbuffer.append("' version='2'><query xmlns='vcard-temp'/></iq>");
        h("vcard", "/raw.xml", stringbuffer.toString());
    }

    final void a(String s1, String s2, String s3, String s4, String s5, int i1, String s6)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<iq type='set' to='" + l(s1) + "'>");
        stringbuffer.append("<query xmlns='vcard-temp'><NICKNAME>" + l(s2) + "</NICKNAME><ADR><REGION>" + l(s3) + "</REGION>");
        stringbuffer.append("<PCODE>" + l(s4) + "</PCODE></ADR><ROLE>" + l(s5) + "</ROLE><DESC>" + l(s6) + "</DESC><ICON>" + i1 + "</ICON></query></iq>");
        h("vcard", "/raw.xml", stringbuffer.toString());
    }

    final void f()
    {
        if(i != null)
        {
            k = true;
            h("logout", "/logout-sid.xml", null);
        }
    }

    final void a(String s1, String s2, String s3, String s4, String s5, String s6, String s7)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<message to='" + l(s1) + "'>");
        if(s2 != null && s2.length() > 0)
            stringbuffer.append("<subject>" + l(s2) + "</subject>");
        stringbuffer.append("<body>" + l(s3) + "</body>");
        if(s4 != null && s4.length() > 0)
            stringbuffer.append("<thread>" + l(s4) + "</thread>");
        if(s5 != null && s5.length() > 0)
        {
            stringbuffer.append("<x xmlns='jabber:x:oob'>");
            stringbuffer.append("<url>" + l(s5) + "</url>");
            stringbuffer.append("<desc></desc>");
            stringbuffer.append("</x>");
        }
        if(s6 != null && s6.length() > 0 && s7 != null && s7.length() > 0)
            stringbuffer.append("<ext><source from='" + s6 + "' value='" + s7 + "'/></ext>");
        stringbuffer.append("</message>");
        System.out.println(stringbuffer);
        h("message", "/raw.xml", stringbuffer.toString());
    }

    final void d(String s1, String s2)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<message to='" + l(s1) + "'>");
        stringbuffer.append("<body>" + l(s2) + "</body>");
        stringbuffer.append("<subject>recommendation</subject>");
        stringbuffer.append("</message>");
        h("invite", "/raw.xml", stringbuffer.toString());
    }

    final void h(String s1)
    {
        h("modifyPassword", "/raw.xml", "<iq type='set' to='pica'><query xmlns='jabber:iq:register'><username>" + l(b.n) + "</username><password>" + l(s1) + "</password></query></iq>");
    }

    final void e(String s1, String s2)
    {
        h("modifyGroup", "/raw.xml", "<iq type='set'><query xmlns='jabber:iq:newgroup'><item oldgroup='" + l(s1) + "' newgroup='" + l(s2) + "'/></query></iq>");
    }

    final void a(String s1, String s2, String s3, String s4, int i1)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<presence");
        if(s2 != null)
            stringbuffer.append(" type='" + l(s2) + "'");
        if(s1 != null)
            stringbuffer.append(" to='" + l(s1) + "'");
        stringbuffer.append(">");
        if(s3 != null)
            stringbuffer.append("<show>" + l(s3) + "</show>");
        if(s4 != null)
            stringbuffer.append("<status>" + l(s4) + "</status>");
        if(i1 != 0)
            stringbuffer.append("<priority>" + l(String.valueOf(i1)) + "</priority>");
        stringbuffer.append("</presence>");
        h("presence", "/raw.xml", stringbuffer.toString());
    }

    final void a(String s1, String s2, String s3, String s4)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<iq type='set'><query xmlns='jabber:iq:roster'><item jid='" + l(s1) + "'");
        if(s2 != null)
            stringbuffer.append(" name='" + l(s2) + "'");
        else
            stringbuffer.append(" name=''");
        if(s4 != null)
            stringbuffer.append(" subscription='" + l(s4) + "'");
        stringbuffer.append(">");
        if(s3 != null)
            stringbuffer.append("<group>" + l(s3) + "</group>");
        stringbuffer.append("</item></query></iq>");
        h("contact", "/raw.xml", stringbuffer.toString());
    }

    final void b(String s1, String s2, String s3, String s4, String s5, String s6, String s7)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<message");
        stringbuffer.append(" to='" + s1 + "'>");
        stringbuffer.append("<subject>" + s2 + "</subject>");
        stringbuffer.append("<body>" + s3 + "</body>");
        stringbuffer.append("<tag>" + s4 + "</tag>");
        if(s5 != null && !s5.equals("") && s6 != null && !s6.equals("") && s7 != null && !s7.equals(""))
        {
            stringbuffer.append("<castattr");
            stringbuffer.append(" cast-type='" + s5 + "'");
            stringbuffer.append(" cast-dest-id='" + s6 + "'");
            stringbuffer.append(" cast-visible='" + s7 + "'");
            stringbuffer.append("/>");
        }
        stringbuffer.append("</message>");
        h("individualSpace", "/raw.xml", stringbuffer.toString());
    }

    final void f(String s1, String s2)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<presence type='" + s1 + "'");
        if(s2 != null)
            stringbuffer.append(" to='" + l(s2) + "'");
        stringbuffer.append(">");
        if(b.m != null)
        {
            stringbuffer.append("<show>");
            stringbuffer.append(b.m);
            stringbuffer.append("</show>");
        }
        stringbuffer.append("<icon>" + b.y + "</icon>");
        stringbuffer.append("<v_stream>no</v_stream>");
        stringbuffer.append("<v_msg>no</v_msg>");
        stringbuffer.append("<unibrew>no</unibrew><source>" + l(b.d) + "</source>");
        stringbuffer.append("</presence>");
        h("mypresence", "/raw.xml", stringbuffer.toString());
    }

    final void a(String s1, String s2, int i1)
    {
        StringBuffer stringbuffer = new StringBuffer();
        String s3 = "";
        if(i1 == 0)
            s3 = "none";
        else
        if(i1 == 1)
            s3 = "blacklist";
        stringbuffer.append("<iq type='set' to='" + b.B + "'>");
        stringbuffer.append("<query xmlns='pica:cluster:role'>");
        stringbuffer.append("<item jid='" + s1 + "' role='" + s3 + "' reason='" + l(s2) + "'/>");
        stringbuffer.append("</query></iq>");
        h("sendKickorBlack", "/raw.xml", stringbuffer.toString());
    }

    final void d(String s1, String s2, String s3)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<iq type='set' to='cluster.pica'>");
        stringbuffer.append("<query xmlns='pica:cluster:join'>");
        stringbuffer.append("<item jid='" + s1 + "' nickname='" + l(s2) + "' status='" + l(s3) + "'/>");
        stringbuffer.append("</query></iq>");
        h("sendaddCluster", "/raw.xml", stringbuffer.toString());
    }

    final void a(String s1, String s2, String s3, String s4, String s5)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<iq type='set' to='cluster.pica'><query xmlns='pica:cluster:create'>");
        stringbuffer.append("<NICKNAME>" + l(s1) + "</NICKNAME>");
        stringbuffer.append("<CATEGORY>" + s2 + "</CATEGORY>");
        stringbuffer.append("<OWNER>" + b.f() + "</OWNER>");
        stringbuffer.append("<AUTH>" + s3 + "</AUTH>");
        stringbuffer.append("<SPEAK>" + l(s4) + "</SPEAK>");
        stringbuffer.append("<DESC>" + l(s5) + "</DESC>");
        stringbuffer.append("</query></iq>");
        h("sendaddCluster", "/raw.xml", stringbuffer.toString());
    }

    final void g(String s1, String s2)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<iq type='set' to='cluster.pica'>");
        stringbuffer.append("<query xmlns='pica:cluster:join'>");
        stringbuffer.append("<item jid='" + s1 + "' subscription='" + s2 + "'/>");
        stringbuffer.append("</query></iq>");
        h("sendJoinClusterVerify", "/raw.xml", stringbuffer.toString());
    }

    final void i(String s1)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<iq type='get' to='");
        stringbuffer.append(s1);
        stringbuffer.append("'><query xmlns='vcard-temp'/></iq>");
        h("getClusterInfo", "/raw.xml", stringbuffer.toString());
    }

    final void h(String s1, String s2)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<presence type='available' to='" + s1 + "'><show>" + l(s2) + "</show></presence>");
        h("sendOnlineToCluster", "/raw.xml", stringbuffer.toString());
    }

    final void j(String s1)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<presence type='available' to='");
        stringbuffer.append(s1);
        stringbuffer.append("'><show>leave</show></presence>");
        h("logoutCluster", "/raw.xml", stringbuffer.toString());
    }

    final void a(String s1, String s2, String s3, String s4, String s5, String s6)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<iq type='set' to='");
        stringbuffer.append(s1);
        stringbuffer.append("'><query xmlns='vcard-temp'>");
        stringbuffer.append("<NICKNAME>" + l(s2) + "</NICKNAME>");
        stringbuffer.append("<SEX>" + s3 + "</SEX>");
        stringbuffer.append("<TELEPHONE>" + s4 + "</TELEPHONE>");
        stringbuffer.append("<EMAIL>" + l(s5) + "</EMAIL>");
        stringbuffer.append("<DESC>" + l(s6) + "</DESC></query></iq>");
        h("modifyMyVCard", "/raw.xml", stringbuffer.toString());
    }

    final void c(String s1, String s2, String s3, String s4, String s5, String s6, String s7)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<iq type='set' to='");
        stringbuffer.append(s1);
        stringbuffer.append("'><query xmlns='vcard-temp'>");
        stringbuffer.append("<NICKNAME>" + l(s2) + "</NICKNAME>");
        stringbuffer.append("<CATEGORY>" + s3 + "</CATEGORY>");
        stringbuffer.append("<OWNER>" + s4 + "</OWNER>");
        stringbuffer.append("<AUTH>" + s5 + "</AUTH>");
        stringbuffer.append("<DESC>" + l(s6) + "</DESC>");
        stringbuffer.append("<SPEAK>" + l(s7) + "</SPEAK></query></iq>");
        h("modifyClusterInfo", "/raw.xml", stringbuffer.toString());
    }

    final void k(String s1)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<iq type='set' to='");
        stringbuffer.append(l(b.B));
        stringbuffer.append("'><query xmlns='pica:cluster:bulletin'><body>");
        stringbuffer.append(l(s1));
        stringbuffer.append("</body></query></iq>");
        h("modifyClusterBulletin", "/raw.xml", stringbuffer.toString());
    }

    final void i(String s1, String s2)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<iq type='set' to='");
        stringbuffer.append(b.B);
        stringbuffer.append("'><query xmlns='pica:cluster:role'>");
        stringbuffer.append("<item jid='");
        stringbuffer.append(s1);
        stringbuffer.append("' name='");
        stringbuffer.append(l(s2));
        stringbuffer.append("' role='member'/>");
        stringbuffer.append("</query></iq>");
        h("addClusterMember", "/raw.xml", stringbuffer.toString());
    }

    final void j(String s1, String s2)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<iq type='set' to='");
        stringbuffer.append(l(b.B));
        stringbuffer.append("'><query xmlns='pica:cluster:role'>");
        stringbuffer.append("<item jid='");
        stringbuffer.append(s1);
        stringbuffer.append("' role='");
        stringbuffer.append(l(s2));
        stringbuffer.append("'/>");
        stringbuffer.append("</query></iq>");
        h("changeClusterOwner", "/raw.xml", stringbuffer.toString());
    }

    final void g()
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("<iq type='get' to='cluster.pica'><query xmlns='jabber:iq:newsearch'><REC>10</REC><CLUSTER/><CATEGORY/><NICKNAME/></query></iq>");
        h("commentGoodCluster", "/raw.xml", stringbuffer.toString());
    }

    public final void b(String s1, String s2, String s3, String s4)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("username=").append(s1).append("&password=").append(s2);
        stringbuffer.append("&oldtel=").append(s3);
        stringbuffer.append("&telephone=").append(s4);
        Object obj = null;
        String s5;
        s5 = g("re.pica.com", "/bindtel", stringbuffer.toString());
        break MISSING_BLOCK_LABEL_97;
        JVM INSTR dup ;
        IOException ioexception;
        ioexception;
        printStackTrace();
        a.a(4, ioexception.getMessage());
        return;
        if(s5 != null && s5.startsWith("BIND="))
        {
            int i1 = s5.indexOf(";");
            String s6 = s5.substring(5, i1);
            String s7 = s5.substring(i1 + 6);
            System.out.println("******* code = " + s6 + "; desc = " + s7);
            a.a(42, new String[] {
                s6, s7
            });
        }
        return;
    }

    public final void e(String s1, String s2, String s3)
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("password=").append(s1);
        stringbuffer.append("&age=18&region=\u5E7F\u4E1C&sex=\u5973&icon=").append("" + (5 + Math.abs((new Random()).nextInt() % 4)));
        stringbuffer.append("&source=").append(s3);
        if(s2 != null)
            stringbuffer.append("&telephone=").append(s2);
        s = true;
        t = stringbuffer.toString();
        (new Thread(this)).start();
    }

    private void j()
    {
        s = false;
        u = null;
        v = null;
        t = null;
    }

    public final void run()
    {
        if(s)
        {
            k();
            return;
        }
        if(c == null)
        {
            c = "disp1.mypica.com:2246";
            a.a(1, null);
            l();
            a.a(2, null);
        }
        b(true);
        a.a(3, null);
        b.l = ((byte)(b.f ? 100 : 7));
        b.m = b.f ? "iv" : e.b;
        i();
        break MISSING_BLOCK_LABEL_136;
        JVM INSTR dup ;
        Exception exception;
        exception;
        printStackTrace();
        h.h.append(exception.toString());
        return;
        m();
        return;
    }

    private void k()
        throws Exception
    {
        try
        {
            if(u == null)
            {
                u = "re.pica.com";
                v = "/picaregdisp";
                String s1;
                if(!(s1 = g(u, v, "")).startsWith("http://"))
                {
                    s1 = g(u, v, "");
                    h.h.append(s1);
                }
                if(s1 == null || s1.length() == 0)
                {
                    j();
                    a.a(41, new String[] {
                        null, "\u670D\u52A1\u5668\u5FD9\uFF01"
                    });
                }
                int i1 = (s1 = s1.substring(7)).indexOf('/');
                u = s1.substring(0, i1);
                v = s1.substring(i1);
            }
            String s2;
            if((s2 = g(u, v, t)) != null && s2.startsWith("PICAID="))
            {
                System.out.println("************ " + s2);
                int j1;
                if((j1 = s2.indexOf(";")) > 0)
                {
                    String s3 = s2.substring(7, j1);
                    String s4 = s2.substring(j1 + 6);
                    a.a(41, new String[] {
                        s3, s4
                    });
                } else
                {
                    a.a(40, s2.substring(7));
                    j();
                }
            } else
            {
                a.a(41, new String[] {
                    null, "\u6CE8\u518C\u5931\u8D25\uFF01"
                });
            }
            s = false;
            return;
        }
        catch(Exception exception)
        {
            h.h.append(exception.toString() + "\n");
            throw exception;
        }
    }

    private void l()
        throws Exception
    {
        StringBuffer stringbuffer;
        (stringbuffer = new StringBuffer()).append("id=");
        stringbuffer.append(b.f());
        stringbuffer.append("&version=");
        stringbuffer.append(b.c);
        stringbuffer.append("&type=hz");
        stringbuffer.append("&source=");
        stringbuffer.append(b.d);
        f("dispatch", "/dispatch.xml?" + stringbuffer.toString(), null);
    }

    private void f(String s1, String s2, String s3)
        throws Exception
    {
        int i1;
        Object obj = null;
        if(s3 != null && !s1.equals("dispatch"))
            s3 = (new StringBuffer("<jabber>") + s3 + "</jabber>").toString();
        if(!s1.equals("login") && !s1.equals("dispatch"))
            s2 = (new StringBuffer(s2) + "?sid=" + i).toString();
        i1 = 0;
_L2:
        if(i1 >= 36)
            break; /* Loop/switch isn't completed */
        String s4 = g(c, s2, s3);
        if(s1.equals("dispatch"))
        {
            if(!s4.startsWith("ip="))
                s4 = g(c, s2, s3);
            if(s4.indexOf('&') > 0)
            {
                c = s4.substring(s4.indexOf('=') + 1, s4.indexOf('&'));
                n = s4.substring(s4.indexOf('&') + 1).trim();
            } else
            {
                c = s4.substring(s4.indexOf('=') + 1).trim();
            }
            if(c.equals("0.0.0.0:0"))
                throw new Exception(j);
        } else
        if(s4.length() > 0)
            g.a(new c(s4), s1);
        return;
        JVM INSTR dup ;
        Exception exception;
        exception;
        printStackTrace();
        if(s1 != null && (s1.equals("login") || s1.equals("dispatch")))
        {
            if(j != null)
                throw new Exception(j);
            int j1;
            if((j1 = exception.toString().indexOf("error=")) > 0)
                throw new Exception(exception.toString().substring(j1 + 6));
            else
                throw exception;
        }
        if(i1 == 35 || j != null)
        {
            if(i1 == 35)
            {
                for(int k1 = 0; k1 < 20 && !k; k1++)
                    Thread.sleep(500L);

            }
            throw new Exception("disconnected");
        }
        if(k)
            return;
        for(int l1 = 0; l1 < 20 && !k; l1++)
            Thread.sleep(500L);

        i1++;
        if(true) goto _L2; else goto _L1
_L1:
    }

    private String g(String s1, String s2, String s3)
        throws IOException
    {
        ByteArrayOutputStream bytearrayoutputstream;
        DataOutputStream dataoutputstream;
        DataInputStream datainputstream;
        bytearrayoutputstream = null;
        dataoutputstream = null;
        datainputstream = null;
        bytearrayoutputstream = new ByteArrayOutputStream();
        dataoutputstream = new DataOutputStream(bytearrayoutputstream);
        String s5;
        byte abyte0[] = null;
        if(s3 != null && !s3.equals(""))
        {
            dataoutputstream.writeUTF(s3);
            abyte0 = bytearrayoutputstream.toByteArray();
        }
        datainputstream = a(s1, s2, abyte0, false);
        int i1 = 0;
        byte abyte1[] = null;
        if(r > 0)
        {
            abyte1 = new byte[r];
            datainputstream.readFully(abyte1);
        } else
        {
            int j1 = 1024;
            abyte1 = new byte[1024];
            do
            {
                int k1;
                if((k1 = datainputstream.read()) == -1)
                    break;
                abyte1[i1] = (byte)k1;
                if(++i1 == j1)
                {
                    byte abyte2[] = new byte[j1 += 1024];
                    System.arraycopy(abyte1, 0, abyte2, 0, i1);
                    abyte1 = abyte2;
                }
            } while(true);
        }
        String s4;
        s5 = s4 = new String(abyte1, 0, r <= 0 ? i1 : r, "UTF-8");
        if(datainputstream != null)
            try
            {
                datainputstream.close();
            }
            catch(Exception _ex) { }
        try
        {
            bytearrayoutputstream.close();
        }
        catch(Exception _ex) { }
        try
        {
            dataoutputstream.close();
        }
        catch(Exception _ex) { }
        return s5;
        JVM INSTR dup ;
        Object obj;
        obj;
        throw ;
        JVM INSTR dup ;
        obj;
        printStackTrace();
        if(datainputstream != null)
            try
            {
                datainputstream.close();
            }
            catch(Exception _ex) { }
        try
        {
            bytearrayoutputstream.close();
        }
        catch(Exception _ex) { }
        try
        {
            dataoutputstream.close();
        }
        catch(Exception _ex) { }
        break MISSING_BLOCK_LABEL_324;
        Exception exception;
        exception;
        if(datainputstream != null)
            try
            {
                datainputstream.close();
            }
            catch(Exception _ex) { }
        try
        {
            bytearrayoutputstream.close();
        }
        catch(Exception _ex) { }
        try
        {
            dataoutputstream.close();
        }
        catch(Exception _ex) { }
        throw exception;
        return null;
    }

    private void a(String s1, String s2, ByteArrayOutputStream bytearrayoutputstream)
    {
        Object obj = null;
        DataInputStream datainputstream = a(s1, s2, bytearrayoutputstream.toByteArray(), true);
        Object aobj[];
        (aobj = new Object[2])[0] = datainputstream;
        aobj[1] = new Integer(r);
        a.a(6, ((Object) (aobj)));
        return;
        JVM INSTR dup ;
        Exception exception;
        exception;
        printStackTrace();
        a.a(7, null);
        return;
    }

    private DataInputStream a(String s1, String s2, byte abyte0[], boolean flag)
        throws Exception
    {
        DataOutputStream dataoutputstream;
        d = null;
        dataoutputstream = null;
        Object obj = null;
        String s3 = b.g ? "http://10.0.0.172:80" + s2 : "http://" + s1 + s2;
        d = (HttpConnection)Connector.open(s3, 3, true);
        d.setRequestMethod(abyte0 == null ? "GET" : "POST");
        d.setRequestProperty("X-Online-Host", s1);
        if(abyte0 != null)
            if(flag)
                d.setRequestProperty("Content-Type", "application/octet-stream");
            else
                d.setRequestProperty("Content-Type", "text/xml");
        d.setRequestProperty("User-Agent", "Profile/MIDP-1.0 Configuration/CLDC-1.0");
        if(flag)
            d.setRequestProperty("Pica-Auth", b.a + "/" + b.b);
        else
        if(abyte0 != null)
            d.setRequestProperty("Content-Length", "" + abyte0.length);
        if(abyte0 != null)
        {
            dataoutputstream = d.openDataOutputStream();
            if(flag)
                dataoutputstream.write(abyte0);
            else
                dataoutputstream.write(abyte0, 2, abyte0.length - 2);
            f += abyte0.length;
        }
        Object obj1;
        if(d.getResponseCode() != 200)
            throw new Exception("invalid response,code:" + d.getResponseCode());
        r = (int)d.getLength();
        f += r;
        DataInputStream datainputstream;
        obj1 = datainputstream = d.openDataInputStream();
        if(dataoutputstream != null)
            try
            {
                dataoutputstream.close();
            }
            catch(Exception _ex) { }
        if(d != null)
            try
            {
                d.close();
            }
            catch(Exception _ex) { }
        d = null;
        return ((DataInputStream) (obj1));
        JVM INSTR dup ;
        obj1;
        throw ;
        Exception exception;
        exception;
        h.h.append(exception.toString() + "\n");
        exception.printStackTrace();
        throw exception;
        Exception exception1;
        exception1;
        if(dataoutputstream != null)
            try
            {
                dataoutputstream.close();
            }
            catch(Exception _ex) { }
        if(d != null)
            try
            {
                d.close();
            }
            catch(Exception _ex) { }
        d = null;
        throw exception1;
    }

    private static String l(String s1)
    {
        StringBuffer stringbuffer = new StringBuffer();
        for(int i1 = 0; i1 < s1.length(); i1++)
        {
            char c1;
            switch(c1 = s1.charAt(i1))
            {
            case 60: // '<'
                stringbuffer.append("&lt;");
                break;

            case 62: // '>'
                stringbuffer.append("&gt;");
                break;

            case 38: // '&'
                stringbuffer.append("&amp;");
                break;

            case 39: // '\''
                stringbuffer.append("&apos;");
                break;

            case 34: // '"'
                stringbuffer.append("&quot;");
                break;

            default:
                stringbuffer.append(c1);
                break;
            }
        }

        if(stringbuffer.length() > 0)
            return stringbuffer.toString();
        else
            return "";
    }

    private void h(String s1, String s2, String s3)
    {
        synchronized(h)
        {
            h.addElement(((Object) (new Object[] {
                s1, s2, s3
            })));
        }
    }

    public final void a(String s1, Vector vector, short aword0[])
    {
        try
        {
            ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
            DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream);
            if(aword0 != null)
            {
                String s2 = "j2meV0.1";
                String s3 = "png";
                String s4 = "amr;midi;wav";
                String s5 = (String)b.r()[0];
                int l1 = 24 + s2.getBytes("UTF-8").length + 2 + s3.getBytes("UTF-8").length + 2 + s4.getBytes("UTF-8").length + 2 + s5.getBytes("UTF-8").length;
                dataoutputstream.writeShort(1);
                dataoutputstream.writeInt(l1);
                dataoutputstream.writeByte(1);
                dataoutputstream.writeShort(2);
                dataoutputstream.writeUTF(s2);
                dataoutputstream.writeShort(aword0[0]);
                dataoutputstream.writeShort(aword0[1]);
                dataoutputstream.writeShort(aword0[2]);
                dataoutputstream.writeShort(aword0[3]);
                dataoutputstream.writeByte(aword0[4]);
                dataoutputstream.writeByte(aword0[5]);
                dataoutputstream.writeByte(255);
                dataoutputstream.writeUTF(s3);
                dataoutputstream.writeUTF(s4);
                dataoutputstream.writeByte(0);
                dataoutputstream.writeByte(0);
                dataoutputstream.writeByte(0);
                dataoutputstream.writeByte(0);
                dataoutputstream.writeByte(1);
                dataoutputstream.writeByte(1);
                dataoutputstream.writeByte(1);
                dataoutputstream.writeByte(1);
                dataoutputstream.writeUTF(s5);
            }
            boolean flag = false;
            dataoutputstream.writeShort(2);
            if(vector != null)
            {
                int i1 = 0;
                for(int j1 = 0; j1 < vector.size(); j1++)
                    i1 = ((String[])vector.elementAt(j1))[0].getBytes("UTF-8").length + 2 + ((String[])vector.elementAt(j1))[1].getBytes("UTF-8").length + 2 + 1;

                dataoutputstream.writeInt(8 + i1 + s1.getBytes("UTF-8").length + 2);
                dataoutputstream.writeByte(1);
                dataoutputstream.writeUTF(s1);
                dataoutputstream.writeInt(1000);
                dataoutputstream.writeByte(0);
                dataoutputstream.writeByte(0);
                dataoutputstream.writeByte(vector.size());
                for(int k1 = 0; k1 < vector.size(); k1++)
                {
                    dataoutputstream.writeUTF(((String[])vector.elementAt(k1))[0]);
                    dataoutputstream.writeByte(0);
                    dataoutputstream.writeUTF(((String[])vector.elementAt(k1))[1]);
                }

            } else
            {
                dataoutputstream.writeInt(8 + s1.getBytes("UTF-8").length + 2);
                dataoutputstream.writeByte(0);
                dataoutputstream.writeUTF(s1);
                dataoutputstream.writeInt(1000);
                dataoutputstream.writeByte(0);
                dataoutputstream.writeByte(0);
                dataoutputstream.writeByte(0);
            }
            a("", bytearrayoutputstream);
            return;
        }
        catch(Exception _ex)
        {
            return;
        }
    }

    private void a(String s1, ByteArrayOutputStream bytearrayoutputstream)
    {
        synchronized(h)
        {
            h.addElement(((Object) (new Object[] {
                s1, bytearrayoutputstream
            })));
        }
    }

    private void m()
    {
        long l1 = System.currentTimeMillis();
_L4:
        Object aobj[];
        if(l || k && h.isEmpty())
            break; /* Loop/switch isn't completed */
        aobj = null;
        if(!h.isEmpty())
            synchronized(h)
            {
                aobj = (Object[])h.firstElement();
                h.removeElementAt(0);
            }
        else
        if(!k)
            if(System.currentTimeMillis() - l1 > (long)p || !q)
            {
                aobj = (new Object[] {
                    "cache", "/cache.xml", null
                });
                if(b.i == 3)
                {
                    if(q && o < e.a.length - 1)
                        o++;
                    if(!q)
                        o = 0;
                    p = e.a[o] * 1000;
                }
                l1 = System.currentTimeMillis();
            } else
            {
                Thread.sleep(200L);
            }
        if(aobj == null)
            break MISSING_BLOCK_LABEL_343;
        if(aobj.length == 3)
        {
            f((String)aobj[0], (String)aobj[1], (String)aobj[2]);
            if(!((String)aobj[0]).startsWith("cache"))
            {
                if(b.i != 3)
                {
                    o = 0;
                    p = e.a[o] * 1000;
                }
                l1 = System.currentTimeMillis() - (long)(p - 4000);
            }
            if(aobj[0].equals("logout"))
                return;
            break MISSING_BLOCK_LABEL_343;
        }
        if(aobj.length == 2)
            a(n, (String)aobj[0], (ByteArrayOutputStream)aobj[1]);
        Thread.sleep(100L);
        continue; /* Loop/switch isn't completed */
        JVM INSTR dup ;
        Exception exception;
        exception;
        getMessage();
        JVM INSTR dup ;
        String s1;
        s1;
        JVM INSTR ifnull 375;
           goto _L1 _L2
_L1:
        break MISSING_BLOCK_LABEL_364;
_L2:
        break MISSING_BLOCK_LABEL_375;
        if(s1.equals("disconnected"))
            break MISSING_BLOCK_LABEL_391;
        if(aobj == null || !aobj[0].equals("logout"))
            break MISSING_BLOCK_LABEL_392;
        return;
        if(m)
        {
            m = false;
            return;
        }
        Object aobj1[];
        if(aobj != null && !aobj[0].equals("cache"))
            synchronized(h)
            {
                if(h.size() > 0)
                {
                    if((aobj1 = (Object[])h.firstElement())[0].equals("login"))
                        h.insertElementAt(((Object) (aobj)), 1);
                } else
                {
                    h.insertElementAt(((Object) (aobj)), 0);
                }
            }
        if(true) goto _L4; else goto _L3
_L3:
    }

    public final void h()
    {
        l = true;
    }

    d a;
    b b;
    private a g;
    private Vector h;
    private String i;
    private String j;
    private boolean k;
    private boolean l;
    private boolean m;
    public String c;
    private String n;
    private int o;
    private int p;
    private boolean q;
    private int r;
    private boolean s;
    private String t;
    private String u;
    private String v;
    public HttpConnection d;
    public Thread e;
    public int f;
}
